{% extends 'airshow/base.html' %}
{% load static %}

{% block title %}编辑数据 - {{ table }}{% endblock %}

{% block content %}
<div class="container mt-4">
    <div class="card">
        <div class="card-header bg-primary text-white">
            <h4>编辑 {{ table }}</h4>
        </div>
        <div class="card-body">
            <form method="post">
                {% csrf_token %}
                {% for field in form %}
                <div class="mb-3">
                    <label for="{{ field.id_for_label }}" class="form-label">{{ field.label }}</label>
                    {{ field }}
                    {% if field.help_text %}
                    <div class="form-text">{{ field.help_text }}</div>
                    {% endif %}
                    {% if field.errors %}
                    <div class="alert alert-danger">
                        {{ field.errors }}
                    </div>
                    {% endif %}
                </div>
                {% endfor %}
                <button type="submit" class="btn btn-primary">保存</button>
                <a href="{% url 'airshow:direct_data' table=table %}" class="btn btn-secondary">取消</a>
            </form>
        </div>
    </div>
</div>
{% endblock %} 